package GUI;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class MessWindow extends JFrame {

	private static final long serialVersionUID = 1L;

	Toolkit tool = Toolkit.getDefaultToolkit();
	Dimension screenSize = tool.getScreenSize();
	
	public final int width = (int) screenSize.getWidth();
	public final int height = (int) screenSize.getHeight();
	
	private JTextArea GPSIN;
	private JTextArea GPSOUT;
	private JTextArea ERROR;
	private JTextArea SISNET;
	private JTextArea FTPZIP;
	private JTextArea WHERESAT;


	public MessWindow(String WindowName){
		
		setTitle(WindowName);
		setSize(width, height);
		
		JPanel powZaw = new JPanel();
		powZaw.setLayout(new GridLayout(3, 2));
		
		GPSIN = new JTextArea();
		GPSOUT = new JTextArea();
		FTPZIP = new JTextArea();
		SISNET = new JTextArea();
		WHERESAT = new JTextArea();
		ERROR = new JTextArea();
		
		powZaw.add(new JScrollPane(GPSIN));
		powZaw.add(new JScrollPane(GPSOUT));
		powZaw.add(new JScrollPane(FTPZIP));
		powZaw.add(new JScrollPane(SISNET));
		powZaw.add(new JScrollPane(WHERESAT));
		powZaw.add(new JScrollPane(ERROR));
				
		add(powZaw,BorderLayout.CENTER);
		
	}
	
	public void addText(String tekst, String PoleName){
		
		if (PoleName.equals("GPSIN")) {
			GPSIN.append(tekst);
		} else if(PoleName.equals("GPSOUT")) {
			GPSOUT.append(tekst);
		}else if(PoleName.equals("FTPZIP")) {
			FTPZIP.append(tekst);
		}else if(PoleName.equals("SISNET")) {
			SISNET.append(tekst);
		}else if(PoleName.equals("WHERESAT")) {
			WHERESAT.append(tekst);
		}else {
			ERROR.append(tekst);
		}
		
	}


}
